package StudyCode.summary.mycollection;

import java.util.ArrayList;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class UpdateObjectsStoredInListByReference {
	public static void main(String[] args) {
		ArrayList<Employee> emps = new ArrayList<Employee>();

		emps.add(new Employee("A"));
		emps.add(new Employee("T"));
		emps.add(new Employee("K"));

		System.out.println(emps);

		Employee e = emps.get(1);
		e.setName("www.tah1986.com");

		System.out.println(emps);
	}

	private static class Employee {
		private String name;

		public Employee(String name) {
			this.name = name;
		}

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}

		@Override
		public String toString() {
			return "Employee [name=" + name + "]";
		}

	}
}
